import com.i98labs.gaelyk.frontcontroller.util.UrlUtil;

binding {
	getController = { params ->
		params.controller ? params.controller : UrlUtil.getController(params.fcpUrl)
	}
	getAction = { params ->
		params.action ? params.action : UrlUtil.getAction(params.fcpUrl)
	}
	getId = { params ->
		params.id ? params.id : UrlUtil.getId(params.fcpUrl)
	}
	getAllParams = { params ->
		def prams = UrlUtil.getParams(params.fcpUrl)
		prams.putAll(params)
		prams
	}
	getTemplate = { controller, action ->
		"/views/${controller}/${action}.gtpl"
	}
}

routes {
	get "/@fcpUrl", forward: "/front.groovy?fcpUrl=@fcpUrl"
	get "/", forward: "/front.groovy"
}
